package com.mq;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ytj
 * @date 2024/1/18
 */
@Configuration
public class Demo10Config {

    @Bean
    public DirectExchange demo10DirectExchange() {
        return new DirectExchange(Demo10Message.EXCHANGE_NAME,true,false);
    }

    @Bean
    public Queue demo10Queue() {
        return new Queue(Demo10Message.QUEUE_NAME,true,false,false);
    }

    @Bean
    public Binding demo10Binding() {
        return BindingBuilder.bind(demo10Queue()).to(demo10DirectExchange()).with(Demo10Message.ROUTING_KEY);
    }
}
